import 'normalize.css'
import './assets/main.css'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import App from './App.vue'
import router from './router'
import { useUserInfoStore } from './stores/user'
import { auth } from './directives/v-auth'

const app = createApp(App)

// 全局注册图标
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

app.use(createPinia())
app.use(router)

// app.directive('auth', {
//   mounted(el, binding) {
//     el //指令所在的dom元素
//     binding.value // 指令后面的值
//     const store = useUserInfoStore()
//     console.log(binding.value)

//     if (store.permissionBtnList.includes(binding.value) == false) {
//       //按钮被删除
//       el.remove()
//     }
//   },
// })

app.directive('auth', auth)

app.mount('#app')
